<template>
  <div class="col-xs-offset-2 col-xs-8">
    <div class="page-header">
      <h2>欢迎来到 Vue Router 学习基地</h2>
      <button @click="back">后退</button>
      <button @click="forward">前进</button>
      <button @click="go(2)">go前进2步</button>
      <button @click="go(-2)">go后退2步</button>
    </div>
  </div>
</template>

<script>
export default {
  name: "Banner",
  methods: {
    //后退
    back() {
      this.$router.back();
    },
    //前进
    forward() {
      this.$router.forward();
    },
    //go函数，n>0表示前进n步，n<0表示后退n步
    go(n) {
      this.$router.go(n);
    },
  },
};
</script>